//
//  CustomAlertView.m
//  LittleFairyPoet
//
//  Created by rimi on 15/9/18.
//  Copyright (c) 2015年 周林. All rights reserved.
//

#import "CustomAlertView.h"

@interface CustomAlertView ()

- (void)initializeAppearance;

@end

@implementation CustomAlertView


- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        [self initializeAppearance];
    }
    return self;
}

#pragma mark - private methods
- (void)initializeAppearance {
    self.backgroundColor = [UIColor redColor];
    [self addSubview:self.titleLabel];
    [self addSubview:self.imageView];
    [self addSubview:self.refreshBtn];
    [self addSubview:self.nextBtn];
}
#pragma mark - responds events

#pragma mark - getter
- (UILabel *)titleLabel {
    if (!_titleLabel) {
        _titleLabel = ({
            UILabel * label = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, self.frame.size.width, 30) adjustWidth:YES];
            label.font = [UIFont boldSystemFontOfSize:20];
            label;
        });
    }
    return _titleLabel;
}
- (UIImageView *)imageView {
    if (!_imageView) {
        _imageView = ({
            UIImageView * view = [[UIImageView alloc]initWithFrame:CGRectMake(40, 40, 40, 40) adjustWidth:YES];
            view;
        });
    }
    return _imageView;
}
- (UIButton *)refreshBtn {
    if (!_refreshBtn) {
        _refreshBtn = ({
            UIButton * btn = [UIButton buttonWithType:UIButtonTypeCustom];
            btn.frame = DHFlexibleFrame(CGRectMake(10, 70, 30, 30), YES);
            btn;
        });
    }
    return _refreshBtn;
}
- (UIButton *)nextBtn {
    if (!_nextBtn) {
        _nextBtn = ({
            UIButton * btn = [UIButton buttonWithType:UIButtonTypeCustom];
            btn.frame = DHFlexibleFrame(CGRectMake(10, 70, 30, 30), YES);
            btn;
        });
    }
    return _nextBtn;
}
@end
